<?

if ($DATA['component']['id']) {
	
	$_record = array('id_data' => D_MB_SETTINGS, 'id_parent' => $DATA['component']['id'], 'assoc' => '');
/*
	$_lang_indep = array(
		'new_user_expires' => 5, // days to expire ticket
		'mail_sender' => 'info@engine'
//		'w' => 800, 'h' => 600, 
	);
	
	// which fields are stored in language variations
	$_lang_dep	= array('mail_confirmation', 'mail_confirmation_subj', 'mail_pass_recovery', 'mail_pass_recovery_subj', 'mail_change_confirmation', 'mail_change_confirmation_subj', 'mail_sender_name', 'mail_sent');
*/
	$_fields = array(
		'new_user_expires' => 5, // days to expire ticket
		'mail_sender' => 'info@engine',
		
		'mail_confirmation' 					=> array('large' => true, 'lang' => true),
		'mail_confirmation_subj' 			=> array('large' => true, 'lang' => true),
		'mail_pass_recovery' 				=> array('large' => true, 'lang' => true),
		'mail_pass_recovery_subj' 			=> array('large' => true, 'lang' => true),
		'mail_change_confirmation' 		=> array('large' => true, 'lang' => true),
		'mail_change_confirmation_subj'	=> array('large' => true, 'lang' => true),
		'mail_sender_name' 					=> array('large' => true, 'lang' => true),
		'mail_sent' 							=> array('large' => true, 'lang' => true),
	);

	switch (action(array('editor_save'))) {
	
		case 'editor_save':

			$temp = prepareModel($_fields, $_record);

			dataset('db_delete', tb('data'), "(id_data=".D_MB_SETTINGS.") AND (id_parent={$DATA[component][id]})");
			dataset('savemeta', $temp);
			
			return true;	// end of component edition
	}
	

	$DATA['settings'] = array_merge($_fields, datafetch_array('loadmeta', D_MB_SETTINGS, 
		array('parent' => $DATA['component']['id'], 'getclob' => true)));
	
	foreach($DATA['langs'] as $lang)
		$DATA['settings']['data'][$lang['text']] = datafetch_array('loadmeta', D_MB_SETTINGS, 
			array('parent' => $DATA['component']['id'], 'assoc' => $lang['text'], 'getclob' => true));
		
	return false;

} else exit;
